import request from '../../utils/request'

// 查询
export function fetchList (data) {
  return request.post('/system/interface/config/page', data, {
    trim: true,
    encrypt: true
  })
}

// 创建
export function create (data) {
  return request.twoFA().post('/system/interface/config/create', data)
}

// 修改
export function updateById (data) {
  return request.twoFA().post('/system/interface/config/updateById', data)
}

// 修改状态
export function updateStatus (data) {
  return request.twoFA({
    title: data.disabled ? '禁用接口配置' : '启用接口配置',
    message: '请输入登录密码以继续操作',
    confirmText: data.disabled ? '确认禁用' : '确认启用'
  }).post('/system/interface/config/updateStatus', data, {
    encrypt: true
  })
}

// 删除
export function deleteById (id) {
  return request.twoFA().get(`/system/interface/config/delete/${id}`)
}

// 批量删除
export function deleteByIdInBatch (ids) {
  return request.twoFA().get('/system/interface/config/delete/batch', {
    params: {
      ids,
    },
    encrypt: true
  })
}
